/*   1:    */ package org.intellij.plugins.relaxNG.model.annotation;
/*   2:    */ 
/*   3:    */

import com.intellij.icons.AllIcons.Gutter;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.editor.markup.GutterIconRenderer;
import com.intellij.psi.PsiElement;
import com.intellij.psi.search.PsiElementProcessor.CollectElements;
import com.intellij.psi.xml.XmlFile;
import com.intellij.util.SmartList;
import org.intellij.plugins.relaxNG.model.Define;
import org.intellij.plugins.relaxNG.model.Grammar;
import org.intellij.plugins.relaxNG.model.resolve.GrammarFactory;
import org.intellij.plugins.relaxNG.model.resolve.RelaxIncludeIndex;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import javax.swing.*;
import java.util.Collection;

/*   4:    */
/*   5:    */
/*   6:    */
/*   7:    */
/*   8:    */
/*   9:    */
/*  10:    */
/*  11:    */
/*  12:    */
/*  13:    */
/*  14:    */
/*  15:    */
/*  16:    */
/*  17:    */
/*  18:    */
/*  19:    */
/*  20:    */ 
/*  21:    */ class OverriddenDefineRenderer
/*  22:    */   extends GutterIconRenderer
/*  23:    */ {
/*  24:    */   private final Define a;
/*  25:    */   
/*  26:    */   public OverriddenDefineRenderer(@NotNull Define paramDefine)
/*  27:    */   {
/*  28: 43 */     this.a = paramDefine;
/*  29:    */   }
/*  30:    */   
/*  31:    */   @NotNull
/*  32:    */   public Icon getIcon()
/*  33:    */   {
/*  34: 48 */     Icon tmp3_0 = AllIcons.Gutter.OverridenMethod;
/*  35: 48 */     if (tmp3_0 == null) {
/*  36: 48 */       throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[] { "org/intellij/plugins/relaxNG/model/annotation/OverriddenDefineRenderer", "getIcon" }));
/*  37:    */     }
/*  38: 48 */     return tmp3_0;
/*  39:    */   }
/*  40:    */   
/*  41:    */   @Nullable
/*  42:    */   public AnAction getClickAction()
/*  43:    */   {
/*  44: 53 */     new AnAction()
/*  45:    */     {
/*  46:    */       public void actionPerformed(AnActionEvent paramAnonymousAnActionEvent)
/*  47:    */       {
/*  48: 55 */         PsiElement localPsiElement = OverriddenDefineRenderer.this.a.getPsiElement();
/*  49: 56 */         if ((localPsiElement == null) || (!localPsiElement.isValid())) {
/*  50: 56 */           return;
/*  51:    */         }
/*  52: 58 */         PsiElementProcessor.CollectElements localCollectElements = new PsiElementProcessor.CollectElements();
/*  53: 59 */         XmlFile localXmlFile1 = (XmlFile)localPsiElement.getContainingFile();
/*  54: 60 */         RelaxIncludeIndex.processBackwardDependencies(localXmlFile1, localCollectElements);
/*  55: 61 */         Collection localCollection = localCollectElements.getCollection();
/*  56:    */         
/*  57: 63 */         SmartList localSmartList = new SmartList();
/*  58: 64 */         OverriddenDefineSearcher localOverriddenDefineSearcher = new OverriddenDefineSearcher(OverriddenDefineRenderer.this.a, localXmlFile1, localSmartList);
/*  59: 65 */         for (XmlFile localXmlFile2 : localCollection)
/*  60:    */         {
/*  61: 66 */           Grammar localGrammar = GrammarFactory.getGrammar(localXmlFile2);
/*  62: 67 */           if (localGrammar != null) {
/*  63: 68 */             localGrammar.acceptChildren(localOverriddenDefineSearcher);
/*  64:    */           }
/*  65:    */         }
/*  66: 71 */         if (localSmartList.size() > 0) {
/*  67: 72 */           OverridingDefineRenderer.doClickAction(paramAnonymousAnActionEvent, localSmartList, "Go to overriding define(s)");
/*  68:    */         }
/*  69:    */       }
/*  70:    */     };
/*  71:    */   }
/*  72:    */   
/*  73:    */   public boolean isNavigateAction()
/*  74:    */   {
/*  75: 79 */     return true;
/*  76:    */   }
/*  77:    */   
/*  78:    */   @Nullable
/*  79:    */   public String getTooltipText()
/*  80:    */   {
/*  81: 84 */     return "Is overridden";
/*  82:    */   }
/*  83:    */   
/*  84:    */   public boolean equals(Object paramObject)
/*  85:    */   {
/*  86: 89 */     if (this == paramObject) {
/*  87: 89 */       return true;
/*  88:    */     }
/*  89: 90 */     if ((paramObject == null) || (getClass() != paramObject.getClass())) {
/*  90: 90 */       return false;
/*  91:    */     }
/*  92: 92 */     OverriddenDefineRenderer localOverriddenDefineRenderer = (OverriddenDefineRenderer)paramObject;
/*  93: 94 */     if (!this.a.equals(localOverriddenDefineRenderer.a)) {
/*  94: 94 */       return false;
/*  95:    */     }
/*  96: 96 */     return true;
/*  97:    */   }
/*  98:    */   
/*  99:    */   public int hashCode()
/* 100:    */   {
/* 101:101 */     return this.a.hashCode();
/* 102:    */   }
/* 103:    */ }



/* Location:           E:\idea\

 * Qualified Name:     org.intellij.plugins.relaxNG.model.annotation.OverriddenDefineRenderer

 * JD-Core Version:    0.7.0.1

 */